package javaClassExercise.exception;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Scanner;

/**
 * Created by lomo on 2017/3/16.
 */
public class Test {

    public static void main(String[] args) {
        //String filePath = "/Users/lomo/Downloads/图书TOP250/豆瓣图书TOP250/金庸全集（含三联版15部、旧版10部、新修版15部）/新修版/作品、作者简介.txt";
        String filePath = "/Users/lomo/Documents/text.txt";
        try {
            // read File
            FileReader fileReader = new FileReader(filePath);

//            FileWriter writer = new FileWriter(filePath);
//            writer.write("lomo");
//            writer.flush();
//            writer.close();
//            char[] lo = new char[50];
//            fileReader.read(lo);
//            System.out.println(lo);

            //get data from disc File
            Scanner in = new Scanner(fileReader);
            String input = in.next();
            //int value = Integer.parseInt(input);  //parseInt只能parse10位Int 数
            System.out.println(input);

        }catch (FileNotFoundException e) {
            e.printStackTrace();
        }catch (NumberFormatException e){
            e.printStackTrace();
        }catch (IOException e) {
            e.printStackTrace();
        }finally {
            System.out.println("finally block");
        }

        System.out.println("finally..");


    }
}
